#include "Pch.h"
#include "MainWindow.h"
#include "Config.h"
#include "Atom.h"

class MolliApp : public wxApp
{
public:
	int OnExit();
	bool OnInit();
};

IMPLEMENT_APP(MolliApp)

//#include <crtdbg.h>


bool MolliApp::OnInit()
{
	 wxImage::AddHandler(new wxPNGHandler);
	//_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_CHECK_ALWAYS_DF|_CRTDBG_CHECK_CRT_DF|_CRTDBG_DELAY_FREE_MEM_DF|1);
	InitAtomicInfo();
	config = new Config();
	config->Load();
	if (argc <= 1) {
//#ifdef _DEBUG
		//new MainWindow(_T("\\Biology\\db\\pdb\\pl\\1plu.pdb"));
		new MainWindow(_T("C:\\Users\\Matt Menke\\Documents\\Molli\\pdb\\af\\1afg.pdb.gz"));
//#else
//		new MainWindow();
//#endif
	}
	else {
		for (int i=1; i<argc; i++) {
			MainWindow *frame = new MainWindow(argv[i]);
		}
	}
	// SetTopWindow(the_frame);

	return true;
}

int MolliApp::OnExit() {
	config->Save();
	delete config;
	return 0;
}
